package com.edie.customview.modular.mymvp;

import java.util.concurrent.TimeUnit;

import io.reactivex.Observable;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.functions.Function;
import io.reactivex.schedulers.Schedulers;

/**
 * edie create on 2018/7/19
 */
public class MyMvpModelImpl implements MyMvpContract.IMyMvpModel {
    @Override
    public Observable<String> loadMsg(String msgId) {
        return Observable.just(msgId)
                .delay(3, TimeUnit.SECONDS)
                .subscribeOn(Schedulers.io())
                .map(new Function<String, String>() {
                    @Override
                    public String apply(String s) throws Exception {
                        return String.format("消息ID是  %s", msgId);
                    }
                })
                .observeOn(AndroidSchedulers.mainThread());
    }
}
